package com.lenovo.dh.voteclient;

import java.util.List;

import com.lenovo.dh.voteclient.bean.Option;
import com.lenovo.dh.voteclient.bean.Topics;
import com.lenovo.dh.voteclient.bean.Topics.Topic;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.widget.RadioButton;
import android.widget.RadioGroup;

public class VoteActivity extends Activity {

	private Topic topicEntity;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		topicEntity = (Topic) getIntent().getSerializableExtra("VoteActivity.data");
		
		setContentView(R.layout.activity_vote);
		
		RadioGroup group = (RadioGroup) findViewById(R.id.id_rdo_group);
		List<Option> options = topicEntity.options ;
		for (Option option : options) {
			VoteEntity btn = new VoteEntity(this);
			btn.setText(option.name);
			group.addView(btn);
		}
	}
	
	class VoteEntity extends RadioButton {

		public VoteEntity(Context context) {
			super(context);
		}
	}
	
}
